package com.jbxie.spaceiotmqtt.common;

import lombok.Data;

import java.util.ArrayList;

@Data
public class DataPackage {
    public int[][] nodeLink = {{0,1,1,0,0,1,0,0,0,0},
                                      {1,0,1,0,0,0,0,0,0,1},
                                      {1,1,0,0,0,0,0,0,0,0},
                                      {0,0,0,0,0,1,0,0,0,0},
                                      {0,0,0,0,0,1,0,0,0,0},
                                      {1,0,0,1,1,0,0,1,0,0},
                                      {0,0,0,0,0,0,0,1,0,0},
                                      {0,0,0,0,0,1,1,0,1,1},
                                      {0,0,0,0,0,0,0,1,0,0},
                                      {0,1,0,0,0,0,0,1,0,0}};

    // 计数器
    private int counter;

    // 传输路径
    private ArrayList<String> route;

    public DataPackage(int counter) {
        this.counter = counter;
    }

    public void decrement() {
        this.counter = this.counter - 1;
    }

    @SuppressWarnings("unchecked")
    @Override
    public DataPackage clone() {
        DataPackage result = null;
        try {
            result = (DataPackage) super.clone();
            result.route = (ArrayList<String>) this.route.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return result;
    }

    @Override
    public String toString() {
        return String.format("报文的传输路径为: %s", route);
    }

    //业务标识
    private String businessName;

    //订阅端ip
    private String subIp;

    //订阅主题
    private String topic;

    //消息qos
    private String qos;

    //发布端ip
    private String pubIp;



}
